<?php
// +----------------------------------------------------------------------
// | sfadmin - Suifeng Administration
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2020 http://suifeng.tech All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: suifeng <1787585212@qq.com>
// +----------------------------------------------------------------------

namespace suifeng\builder\form\control;

use suifeng\builder\form\Control;
use suifeng\helper\HtmlHelper;

class Note extends Control
{
    /**
     * 初始化默认属性。
     */
    protected function _init_default()
    {
        parent::_init_default();

        $this->attributes['rows'] = '5';

        if (empty($this->attributes['class'])) {
            $this->attributes['class'] = 'form-control textarea';
        }
    }

    /**
     * 输出HTML。
     *
     * @return string
     */
    protected function _render_core()
    {
        $attributes = $this->attributes;
        $attributes['name'] = $this->name;

        return HtmlHelper::render_tag('textarea', $attributes, $this->submitted_value);
    }
}